package com.scorpionstudio.adapter;

import java.util.List;

import com.scorpionstudio.dantripro.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;

public class AdapterMain extends ArrayAdapter<String> {
	private LayoutInflater mInflater;
	public AdapterMain(Context context, int textViewResourceId,
			List<String> objects) {
		super(context, textViewResourceId, objects);
		mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
	}
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder mHolder;
		String nameMenu = this.getItem(position);
		if(convertView == null){
			mHolder = new ViewHolder();
			convertView = mInflater.inflate(R.layout.item_list_main, null);
			mHolder.tvNameMenu = (TextView) convertView.findViewById(R.id.tv_title_main);
			convertView.setTag(mHolder);
		}else{
			mHolder = (ViewHolder) convertView.getTag();
		}
		mHolder.tvNameMenu.setText(nameMenu);
		return convertView;
	}
	class ViewHolder{
		TextView tvNameMenu;
	}

}
